﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OF.Component.BLL;
using OF.Component.Model;
using OF.Utility;
using OpSystem.common;

namespace OpSystem.Manage.authority
{
    public partial class AuthorityRoleEdit : BasePage
    {
        protected int intID = 0;
        protected int intCID = 0;
        protected string strMessage = "";
        protected string strStyle= "style='display:none;'";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                intID = RequestUtility.GetQueryInt("ID", -1);
                intCID = RequestUtility.GetQueryInt("cid", -1);
             
                if (intID > -1)
                {
                    AuthorityRoleInfo info = AuthorityRoleOperate.GetByID(intID);
                    this.txtName.Text = info.RoleName;
                   
                    
                }
              
            }
        }


        protected void btnSave_Click(object sender, EventArgs e)
        {
            string MessageInfo = "信息修改成功！";
            intID = RequestUtility.GetQueryInt("ID", -1);
            AuthorityRoleInfo info = AuthorityRoleOperate.GetByID(intID);
            if (info == null)
            {
                info = new AuthorityRoleInfo();
            }
          //  AuthorityRoleInfo oldinfo = ObjectCopy<AuthorityRoleInfo>.DeepCopy(info);
            info.RoleName = txtName.Text;
            info.IsActive = 1;
            info.UpdateTime = DateTime.Now;
            if (info.RoleID > 0)
            {
                AuthorityRoleOperate.Update(info);
               // OpOperationLogOperate.SetLog(oldinfo, info, OpUserID, OpUserInfo.OpUserName, (short)LogType.OpUserRoleManage, info.RoleID);
            }
            else
            {
                MessageInfo = "信息创建成功！";
                info.CreatedDate = DateTime.Now;
                AuthorityRoleOperate.Insert(info);
               // OpOperationLogOperate.SetLog(null, info, OpUserID, OpUserInfo.OpUserName, (short)LogType.OpUserRoleManage,info.RoleID);
            }
            strMessage = " BMCW.msg(\"" + MessageInfo + "\",\"" + GetPageUrl("AuthorityRoleList.aspx") + "\",true);";
            
        }
    }
}
